// 作用合并 reducer
export default (reducers)=>{
  return (state = {},action)=>{
    let nextState = {}
    let keys = Object.keys(reducers)
    let hasChanged = false
    for(let k of keys){
      let reducer = reducers[k]
      nextState[k] = reducer(state[k],action)
      hasChanged = hasChanged || nextState[k] !== state[k]
    }
    return hasChanged ? nextState : state
  }

}